<%@ Page Title="Sys_CorporateAccounts Item" Language="C#" AutoEventWireup="true" CodeBehind="Sys_CorporateAccountsItem.aspx.cs" Inherits="Youz.CreditRepay.Manage.Sys_CorporateAccountsItem" %>

<script>
    

    var requireJS = [
        //"assets/js/jquery.form.js"
    ];
    loadJS(requireJS);
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-edit"></i><%: R(LanguageModule.Sys_CorporateAccounts, "Sys_CorporateAccounts", "Sys_CorporateAccounts") %></h2>
            </div>
            <div class="panel-body">
                <form id="frm" class="form-horizontal" method="post" enctype="multipart/form-data" action="Sys/Handlers/Sys_CorporateAccountsHandler.ashx?type=save">
                    <input id="AccountsId" name="AccountsId" type="hidden" />
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_CorporateAccounts, "Country", "所属国家") %></label>
                        <div class="controls">
                            <input type="text" id="Country" name="Country" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_CorporateAccounts, "BankName", "银行名称") %></label>
                        <div class="controls">
                            <input type="text" id="BankName" name="BankName" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_CorporateAccounts, "BankAccountNo", "银行账户号") %></label>
                        <div class="controls">
                            <input type="text" id="BankAccountNo" name="BankAccountNo" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_CorporateAccounts, "BankAccountName", "银行賬戶名") %></label>
                        <div class="controls">
                            <input type="text" id="BankAccountName" name="BankAccountName" maxlength="50" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.M_Common, "Status", "状态") %></label>
                        <div class="controls">
                            <%--<input type="text" id="Status" name="Status" maxlength="4" class="form-control required" />--%>
                            <select name="Status" id="Status" class="form-control required">
                                <option value="1" selected>启用</option>
                                <option value="2">禁用</option>
                            </select>
                        </div>
                    </div>
                    <div class="alert alert-danger" style="display: none;">
                        <button type="button" class="close" data-dismiss="alert">×</button><strong>Oh snap!</strong><span class="content"></span>
                    </div>
                    <div class="form-actions">
                        <button class="btn btn-success" type="submit" id="btnSubmit"><%: R(LanguageModule.M_Common, "btnSubmit", "保存修改") %></button>
                        <button class="btn btn-default" type="button" id="btnCancel"><%: R(LanguageModule.M_Common, "btnCancel", "取消") %></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    var flag = false;

    function validate() {
        return $("#frm").valid();
    };

    function get() {
        $.post("Sys/Handlers/Sys_CorporateAccountsHandler.ashx?type=get", { AccountsId: "<%= WebHelper.Get("AccountsId") %>" }, function (data) {
            $('#frm').fill(data);
            $("#Status").val(data.Status);
        }, 'json');
    }

    $(function () {
        $("#frm").validate({
            errorElement: "span"
        });

        get();

        $("#frm").ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, $form, options) {
                if (flag) {
                    return false;
                }
                else {
                    flag = true;
                    return true;
                }
            },
            success: function (data) {
                if (data.isSuccess) {
                    loadPage("Sys/Sys_CorporateAccountsList.aspx");
                }
                else {
                    $(".alert > .content").html(data.message);
                    $(".alert").show();
                }
                flag = false;
            }
        });

        $("#btnCancel").click(function () {
            loadPage("Sys/Sys_CorporateAccountsList.aspx");
        });
    });

</script>
